﻿<UserControl x:Class="EPE.WPF.UCBuildList"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
              xmlns:my="clr-namespace:EPE.WPF.ControlHelper" 
             d:DesignHeight="700" d:DesignWidth="1024">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"></RowDefinition>
        </Grid.RowDefinitions>

        <Border Grid.Row="0" Height="500" Width="1000" Style="{StaticResource MainBorderStyle}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="140"></RowDefinition>
                    <RowDefinition Height="15"></RowDefinition>
                    <RowDefinition Height="*"></RowDefinition>
                </Grid.RowDefinitions>

                <GroupBox Grid.RowSpan="2" Header="查询条件" Height="130" Width="980" HorizontalAlignment="Center"  Margin="5,10,5,0" Name="groupBox1" VerticalAlignment="Top" Grid.Row="0" Grid.Column="0">
                    <Grid Style="{StaticResource BorderGridStyle}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="35"></RowDefinition>
                            <RowDefinition Height="10"></RowDefinition>
                            <RowDefinition Height="35"></RowDefinition>
                            <RowDefinition Height="10"></RowDefinition>
                            <RowDefinition Height="*"></RowDefinition>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="80"></ColumnDefinition>
                            <ColumnDefinition Width="120"></ColumnDefinition>
                            <ColumnDefinition Width="80"></ColumnDefinition>
                            <ColumnDefinition Width="120"></ColumnDefinition>
                            <ColumnDefinition Width="80"></ColumnDefinition>
                            <ColumnDefinition Width="120"></ColumnDefinition>
                            <ColumnDefinition Width="400"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Label Content="项目名"  Name="lblName"  Grid.Row="0" Grid.Column="0"   VerticalAlignment="Center" Style="{StaticResource LabelStyle}" />
                        <TextBox Name="txtProjectName" Grid.Row="0" Grid.Column="1"  VerticalAlignment="Center" Style="{StaticResource TextBoxStyle}" />
                        <Label Content="楼栋名"  Name="lblBuildName"  Grid.Row="0" Grid.Column="2"   VerticalAlignment="Center" Style="{StaticResource LabelStyle}" />
                        <TextBox Name="txtBuildName" Grid.Row="0" Grid.Column="3"  VerticalAlignment="Center" Style="{StaticResource TextBoxStyle}" />


                        <StackPanel  Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="7" Orientation="Horizontal" >
                            <Button  Name="btnSearch" Click="btnSearch_Click" Style="{StaticResource ButtonStyle}">
                                <StackPanel Orientation="Horizontal" >
                                    <Image Source="/resources/image/close04.png" Stretch="Fill" Style="{StaticResource ButtonImageStyle}"></Image>
                                    <Label Content="查询" HorizontalAlignment="Center" Style="{StaticResource ButtonLabelStyle}"></Label>
                                </StackPanel>
                            </Button>

                            <Button   Name="btnAdd"  Click="btnAdd_Click" Style="{StaticResource ButtonStyle}" >
                                <StackPanel Orientation="Horizontal" >
                                    <Image Source="/resources/image/close08.png" Stretch="Fill" Style="{StaticResource ButtonImageStyle}"></Image>
                                    <Label Content="添加" HorizontalAlignment="Center" Style="{StaticResource ButtonLabelStyle}"></Label>
                                </StackPanel>
                            </Button>
                            <Button Name="btnImport" Style="{StaticResource ButtonStyle}">
                                <StackPanel Orientation="Horizontal" >
                                    <Image Source="/resources/image/close08.png" Stretch="Fill" Style="{StaticResource ButtonImageStyle}"></Image>
                                    <Label Content="数据导入" HorizontalAlignment="Center" Style="{StaticResource ButtonLabelStyle}"></Label>
                                </StackPanel>

                            </Button>

                        </StackPanel>


                    </Grid>
                </GroupBox>

                <GroupBox Header="一览" Height="330" Grid.Row="2" Grid.Column="0" HorizontalAlignment="Center"  Margin="5,0,5,0" Name="groupBox2" VerticalAlignment="Top" Width="980">
                    <StackPanel Orientation="Vertical">

                        <DataGrid Style="{StaticResource DataGridStyle}" Grid.Row="4" Grid.Column="0" Margin="5,10,5,0" Grid.ColumnSpan="5" Height="270" Width="950" Name="dgList" HorizontalAlignment="Center"  VerticalAlignment="Top"  AutoGenerateColumns="False" ItemsSource="{Binding}"  SelectionMode="Single" IsReadOnly="True">
                            <DataGrid.Columns>
                                <DataGridTextColumn Visibility="Hidden" Binding="{Binding buildid}"></DataGridTextColumn>
                                <DataGridTextColumn Header="项目名称" Width="100" Binding="{Binding projectname}" ></DataGridTextColumn>
                                <DataGridTextColumn Header="幢名称" Width="100" Binding="{Binding buildname}" ></DataGridTextColumn>
                                <DataGridTextColumn Header="建筑功能" Width="100" Binding="{Binding buildfuction}" ></DataGridTextColumn>
                                <DataGridTextColumn Header="总层数" Width="100" Binding="{Binding alllayer}" ></DataGridTextColumn>
                                <DataGridTextColumn Header="地上层数" Width="100" Binding="{Binding groudlayer}" ></DataGridTextColumn>
                                <DataGridTextColumn Header="占地面积" Width="100" Binding="{Binding area}" ></DataGridTextColumn>
                                <DataGridTextColumn Header="建筑面积" Width="100" Binding="{Binding buildarea}" ></DataGridTextColumn>
                                <DataGridTextColumn Header="座落" Width="100" Binding="{Binding located}" ></DataGridTextColumn>
                                <DataGridTextColumn Header="开工日期" Width="100"  Binding="{Binding  startdate, StringFormat='yyyy-MM-dd'}"  ></DataGridTextColumn>
                                <DataGridTextColumn Header="竣工日期" Width="100"  Binding="{Binding  enddate, StringFormat='yyyy-MM-dd'}"  ></DataGridTextColumn>
                                <DataGridTextColumn Header="产权登记状态" Width="100" Binding="{Binding property}" ></DataGridTextColumn>
                                

                                <DataGridTemplateColumn Header="操作">
                                    <DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <StackPanel Orientation="Horizontal">
                                                <Button  Style="{StaticResource DataRowButtonStyle}" Name="btnEdit" Click="btnEdit_Click"  >

                                                    <StackPanel Orientation="Horizontal">
                                                        <Image Source="Resources\image\fk_bj.png"></Image>

                                                    </StackPanel>
                                                </Button>
                                                <Button  Style="{StaticResource DataRowButtonStyle}" Name="btnDel" Click="btnDel_Click">
                                                    <StackPanel Orientation="Horizontal">
                                                        <Image Source="Resources\image\fk_cs.png"></Image>

                                                    </StackPanel>
                                                </Button>
                                            </StackPanel>

                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellTemplate>
                                </DataGridTemplateColumn>
                            </DataGrid.Columns>

                        </DataGrid>
                        <my:DataGridPager x:Name="pagectrl" PagerIndexChanged="pagectrl_PagerIndexChanged" ></my:DataGridPager>
                    </StackPanel>
                </GroupBox>
            </Grid>
        </Border>
    </Grid>
</UserControl>
